import axiosRequest from "@/api/axios-optimize"

// 判断是否存在
export function judgeExist(data = {}, config = {
  noShowLoading: true, // 不展示全局加载动画
  preventDuplicateRequestsType: "cancel"
}) {
  return axiosRequest.post(`/xiaobuAdmin/system/config/judgeExist`, data, config)
}

// 获取列表
export function getList(data = {}, config = {
  preventDuplicateRequestsType: "cancel",
  noShowLoading: true // 不展示全局加载动画
}) {
  return axiosRequest.get(`/xiaobuAdmin/system/config`, { params: data, ...config})
}

// 获取详情
export function getDetailById(data = {}, config = {
  preventDuplicateRequestsType: "prevent"
}) {
  return axiosRequest.get(`/xiaobuAdmin/system/config/${data.id}`, { params: {}, ...config})
}

// 更新
export function updateItem(data = {}, config = {
  preventDuplicateRequestsType: "prevent"
}) {
  return axiosRequest.put(`/xiaobuAdmin/system/config/${data.configId}`, data, config)
}

// 新增
export function createItem(data = {}, config = {
  preventDuplicateRequestsType: "prevent"
}) {
  return axiosRequest.post(`/xiaobuAdmin/system/config`, data, config)
}

// 删除
export function deleteItem(data = {}, config = {
  noShowLoading: true, // 不展示全局加载动画
  preventDuplicateRequestsType: "prevent"
}) {
  return axiosRequest.delete(`/xiaobuAdmin/system/config/${data.id}`, { data, ...config})
}

// 批量删除
export function batchDeleteItems(data = {}, config = {
  preventDuplicateRequestsType: "prevent"
}) {
  return axiosRequest.post(`/xiaobuAdmin/system/config/batchDelete`, data, config)
}

// 改变状态
export function changeStatus(data = {}, config = {
  preventDuplicateRequestsType: "cancel"
}) {
  return axiosRequest.post(`/xiaobuAdmin/system/config/changeStatus`, data, config)
}

// 管理相关接口 结束